Socket
Socket
Sign inDemoInstall

eth-query

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eth-query

like web3 but for minimalists


Version published
Weekly downloads
216K
decreased by-24.61%
Maintainers
1
Weekly downloads
 
Created

What is eth-query?

The eth-query npm package is a utility for interacting with Ethereum nodes. It provides a simple interface to make JSON-RPC calls to an Ethereum node, allowing developers to query blockchain data, send transactions, and interact with smart contracts.

What are eth-query's main functionalities?

Querying Blockchain Data

This feature allows you to query blockchain data such as blocks, transactions, and logs. The code sample demonstrates how to get the latest block using eth-query.

const EthQuery = require('eth-query');
const ethQuery = new EthQuery(provider);

ethQuery.getBlockByNumber('latest', (err, block) => {
  if (err) console.error(err);
  else console.log(block);
});

Sending Transactions

This feature allows you to send transactions to the Ethereum network. The code sample demonstrates how to send a transaction using eth-query.

const EthQuery = require('eth-query');
const ethQuery = new EthQuery(provider);

const txParams = {
  from: '0xYourAddress',
  to: '0xRecipientAddress',
  value: '0xAmountInWei',
  gas: '0xGasLimit'
};

ethQuery.sendTransaction(txParams, (err, txHash) => {
  if (err) console.error(err);
  else console.log(txHash);
});

Interacting with Smart Contracts

This feature allows you to interact with smart contracts by calling their functions. The code sample demonstrates how to call a smart contract function using eth-query.

const EthQuery = require('eth-query');
const ethQuery = new EthQuery(provider);

const contractAddress = '0xContractAddress';
const data = '0xEncodedFunctionCall';

ethQuery.call({ to: contractAddress, data: data }, (err, result) => {
  if (err) console.error(err);
  else console.log(result);
});

Other packages similar to eth-query

FAQs

Package last updated on 15 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc